#ifndef MODEL_HPP_
#define MODEL_HPP_

#include <vector>

#include <aerDefs.hpp>
//#include <aerMesh.hpp>
#include <device/aerVertexArray.hpp>
#include <device/aerDeviceBuffer.hpp>
#include <aerMaterial.hpp>
#include <device/aerProgram.hpp>//
#include <view/aerCamera.hpp>


///
/// [ temporary class ]
/// Represent a mesh object and its material attributes
///
class Model
{
  private:
    struct SkinnedVertex
    {
      aer::F32 position[3];
      aer::F32 normal[3];
      aer::F32 texCoord[2];
      
      aer::U8  jointIndex[4];   // up to 4 contributing joint
      aer::F32 jointWeight[3];  // fourth weigth w = 1 - x - y - z
    };
    
    struct Object_t 
    {
      //aer::Mesh mesh;      
      aer::VertexArray vao;
      aer::DeviceBuffer vbo;
      aer::U32 id_mat;
      aer::U32 numVertices;
    };
    
    
  private:
    /// Rendering
    std::vector<Object_t> m_objects;
    std::vector<aer::Material> m_materials;
    aer::Program m_program;    
    
    
  public:
    Model();
    ~Model();
    
    void load(const char *modelName);    
    void render(aer::Camera *camera);
  
};

#endif //MODEL_HPP_
